<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <!-- 导入vue.js -->
    <script src="vue.js"></script>
    <!-- 导入elementui的css及js -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <script src="../plugins/elementui/index.js"></script>


</head>
<body>

    <div id="app">
        <template>
            <el-button :plain="true" @click="open2">成功</el-button>
            <el-button :plain="true" @click="open3">警告</el-button>
            <el-button :plain="true" @click="open1">消息</el-button>
            <el-button :plain="true" @click="open4">错误</el-button>


            <el-button type="text" @click="del(1)">删除</el-button>
        </template>

    </div>

</body>
<script>
    new Vue({
        el : "#app",
        data() {
            return {

            };
        },
        methods: {
            open1() {
                this.$message('这是一条消息提示');
            },
            open2() {
                this.$message({
                    message: '恭喜你，这是一条成功消息',
                    type: 'success'
                });
            },

            open3() {
                this.$message({
                    message: '警告哦，这是一条警告消息',
                    type: 'warning'
                });
            },

            open4() {
                this.$message.error('错了哦，这是一条错误消息');
            },

            del(id){
                this.$confirm(`是否删除id为${id}的记录?`, '删除提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    });
                }).catch(() => {
                });
            }
        }
    });
</script>

</html>